Transfer from http://blog.csdn.net/houserabbit/article/details/41513745It's really good to write.Title Link: Http://codeforces.com/problemset/problem/487/CThe main idea: construct a 1~n arrangement so that n-prefix product pair n is a 0~n-1
Codeforces into C Prefix Product Sequence (Modulo inverse element + constructor), codeforces487c
C. Prefix Product Sequencetime limit per test1 secondmemory limit per test256 megabytes
Consider a sequence [A1, bytes,A2, middle..., middle ,...,AN].
Original code, anti-code, complement detailed
This article explains the computer's original code, the inverse code and the complement. It also explores why to use the inverse code and the complement, and further demonstrates why the inverse code,
Expand Euclid, find a group of x, Y, making gcd (A, b) = d = A * x + b * yvoid exgcd (int a,int b,int &d,int &x,int &y) { if (b = = 0) { x = 1; y = 0; D = A; } else { exgcd (b,a%b,d,y,x); Y-= x* (A/b)
The main effect of the topic:
Given two positive integers and, all the factors and the value of 9901 after the remainder.
Analysis:
It's easy to know, first to get the decomposition, then get, then
All of the factors and expressions are as follows
BriefAshamed to say that although the first contact with the computer has learned the original code, anti-code and the complement of content, but recently relive the "What is this thing", it seems that the original only to deal with the exam. This
Transferred from Http://www.cnblogs.com/zhangziqiu/archive/2011/03/30/ComputerCode.html#!comments
This article explains the computer's original code, the inverse code and the complement. It also explores why to use the inverse code and the
Before we begin, we introduce the 3 theorems:1. Multiplication inverse (also called the reciprocal in Wikipedia, of course, after mod p, is actually the countdown is not it?) ):If Ax≡1 (mod p), and GCD (a,p) =1 (A and P coprime), then a
Reprint please specify the source [ametake All rights reserved]http://blog.csdn.net/ametake Welcome to seeIt took me one hours to finally get the multiplication inverse in mind. In view of my clumsy IQ, hold on to these records. In this column Ming
The previous period of time to carefully study the original code, anti-code, the complement of knowledge, and met today, did not think and forget, hey, good memory as bad writing ~.Later found a special introduction to this aspect of the article,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.